<?php 
require('./lib/init.php');

//判断表达是否有post数据
if(empty($_POST)){
	include('./view/admin/catadd.html');
}else{
	//接受post传递过来的值
	$cat['catname'] = trim($_POST['catname']);
	//var_dump($cat);
	if(empty($cat['catname'])){
		exit('栏目不能为空');
	}
	
	/*$conn = mysql_connect('127.0.0.1','root','root');
	mysql_query('use blog',$conn);
	mysql_query('set names utf8',$conn);*/

	//$sql = "insert into cat(catname) values ('$cat[catname]')";
	//echo $sql;
	//$m = mysql_query($sql);
	//var_dump($m);
	if(mExec('cat',$cat)){
		succ('栏目添加成功');
	}else{
		error('添加失败');
	}
}

